<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns:yui="http://yuilibrary.com/rdf/1.0/yui.rdf#">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<title>API: widget-child   Widget-Child.js  (YUI Library)</title>

	<link rel="stylesheet" type="text/css" href="assets/reset-fonts-grids-min.css" />
	<link rel="stylesheet" type="text/css" href="assets/api.css" />

    <script type="text/javascript" src="assets/api-js"></script>
    <script type="text/javascript" src="assets/ac-js"></script>
</head>

<body id="yahoo-com">

<div id="doc3" class="yui-t2">
	<div id="hd">
        <h1><a href="http://developer.yahoo.com/yui/" title="Yahoo! UI Library">Yahoo! UI Library</a></h1>
        <h3>widget-child&nbsp; <span class="subtitle">3.1.1</span></h3>
        <a href="./index.html" title="Yahoo! UI Library">Yahoo! UI Library</a> 
            &gt; <a href="./module_widget-child.html" title="widget-child">widget-child</a>
                
                 &gt; Widget-Child.js (source view) 
        <form onsubmit="return false">
            <div id="propertysearch">
                Search: <input autocomplete="off" id="searchinput" />
                <div id="searchresults">
                    &nbsp;
                </div>
            </div>
        </form>
	</div>

	<div id="bd">
		<div id="yui-main">
			<div class="yui-b">
            <form action="#" name="yui-classopts-form" method="get" id="yui-classopts-form">
                <fieldset>
                    <legend>Filters</legend>
                <span class="classopts"><input type="checkbox" name="show_private" id="show_private" /> <label for="show_private">Show Private</label></span>
                <span class="classopts"><input type="checkbox" name="show_protected" id="show_protected" /> <label for="show_protected">Show Protected</label></span>
                <span class="classopts"><input type="checkbox" name="show_deprecated" id="show_deprecated" /> <label for="show_deprecated">Show Deprecated</label></span>
                </fieldset>
            </form>

                    <div id="srcout">
                        <style>
                            #doc3 .classopts { display:none; }
                        </style>
                        <div class="highlight"><pre><span class="cm">/**</span>
<span class="cm"> * Extension enabling a Widget to be a child of another Widget.</span>
<span class="cm"> *</span>
<span class="cm"> * @module widget-child</span>
<span class="cm"> */</span>

<span class="kd">var</span> <span class="nx">Lang</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Lang</span><span class="p">;</span>

<span class="cm">/**</span>
<span class="cm"> * Widget extension providing functionality enabling a Widget to be a </span>
<span class="cm"> * child of another Widget.</span>
<span class="cm"> *</span>
<span class="cm"> * @class WidgetChild</span>
<span class="cm"> * @param {Object} config User configuration object.</span>
<span class="cm">*/</span>
<span class="kd">function</span> <span class="nx">Child</span><span class="p">()</span> <span class="p">{</span>

    <span class="c1">//  Widget method overlap</span>
    <span class="nx">Y</span><span class="p">.</span><span class="nx">after</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_syncUIChild</span><span class="p">,</span> <span class="k">this</span><span class="p">,</span> <span class="s2">&quot;syncUI&quot;</span><span class="p">);</span>
    <span class="nx">Y</span><span class="p">.</span><span class="nx">after</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_bindUIChild</span><span class="p">,</span> <span class="k">this</span><span class="p">,</span> <span class="s2">&quot;bindUI&quot;</span><span class="p">);</span>

<span class="p">}</span>

<span class="nx">Child</span><span class="p">.</span><span class="nx">ATTRS</span> <span class="o">=</span> <span class="p">{</span>

    <span class="cm">/**</span>
<span class="cm">     * @attribute selected</span>
<span class="cm">     * @type Number</span>
<span class="cm">     * @default 0</span>
<span class="cm">     *</span>
<span class="cm">     * @description Number indicating if the Widget is selected.  Possible </span>
<span class="cm">     * values are:</span>
<span class="cm">     * &lt;dl&gt;</span>
<span class="cm">     * &lt;dt&gt;0&lt;/dt&gt; &lt;dd&gt;(Default) Not selected&lt;/dd&gt;</span>
<span class="cm">     * &lt;dt&gt;1&lt;/dt&gt; &lt;dd&gt;Fully selected&lt;/dd&gt;</span>
<span class="cm">     * &lt;dt&gt;2&lt;/dt&gt; &lt;dd&gt;Partially selected&lt;/dd&gt;</span>
<span class="cm">     * &lt;/dl&gt;</span>
<span class="cm">    */</span>
    <span class="nx">selected</span><span class="o">:</span> <span class="p">{</span>   
        <span class="nx">value</span><span class="o">:</span> <span class="mi">0</span><span class="p">,</span>
        <span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="p">.</span><span class="nx">isNumber</span>
    <span class="p">},</span>


    <span class="cm">/**</span>
<span class="cm">     * @attribute index</span>
<span class="cm">     * @type Number</span>
<span class="cm">     * @readOnly</span>
<span class="cm">     *</span>
<span class="cm">     * @description Number representing the Widget&#39;s ordinal position in its </span>
<span class="cm">     * parent Widget.</span>
<span class="cm">     */</span>
    <span class="nx">index</span><span class="o">:</span> <span class="p">{</span>
        <span class="nx">readOnly</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
        <span class="nx">getter</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
            
            <span class="kd">var</span> <span class="nx">parent</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;parent&quot;</span><span class="p">),</span>
                <span class="nx">index</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span><span class="p">;</span>
            
            <span class="k">if</span> <span class="p">(</span><span class="nx">parent</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">index</span> <span class="o">=</span> <span class="nx">parent</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="k">this</span><span class="p">);</span>
            <span class="p">}</span>
            
            <span class="k">return</span> <span class="nx">index</span><span class="p">;</span>
            
        <span class="p">}</span>
    <span class="p">},</span>


    <span class="cm">/**</span>
<span class="cm">     * @attribute parent</span>
<span class="cm">     * @type Widget</span>
<span class="cm">     * @readOnly</span>
<span class="cm">     *</span>
<span class="cm">     * @description Retrieves the parent of the Widget in the object hierarchy.</span>
<span class="cm">    */</span>
    <span class="nx">parent</span><span class="o">:</span> <span class="p">{</span>
        <span class="nx">readOnly</span><span class="o">:</span> <span class="kc">true</span>
    <span class="p">},</span>


    <span class="cm">/**</span>
<span class="cm">     * @attribute depth</span>
<span class="cm">     * @type Number</span>
<span class="cm">     * @default -1 </span>
<span class="cm">     * @readOnly         </span>
<span class="cm">     *</span>
<span class="cm">     * @description Number representing the depth of this Widget relative to </span>
<span class="cm">     * the root Widget in the object heirarchy.</span>
<span class="cm">     */</span>
    <span class="nx">depth</span><span class="o">:</span> <span class="p">{</span>
        <span class="nx">readOnly</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
        <span class="nx">getter</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
            
            <span class="kd">var</span> <span class="nx">parent</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;parent&quot;</span><span class="p">),</span>
                <span class="nx">root</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;root&quot;</span><span class="p">),</span>
                <span class="nx">depth</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span><span class="p">;</span>
            
            <span class="k">while</span> <span class="p">(</span><span class="nx">parent</span><span class="p">)</span> <span class="p">{</span>

                <span class="nx">depth</span> <span class="o">=</span> <span class="p">(</span><span class="nx">depth</span> <span class="o">+</span> <span class="mi">1</span><span class="p">);</span>

                <span class="k">if</span> <span class="p">(</span><span class="nx">parent</span> <span class="o">==</span> <span class="nx">root</span><span class="p">)</span> <span class="p">{</span>
                    <span class="k">break</span><span class="p">;</span>
                <span class="p">}</span>

                <span class="nx">parent</span> <span class="o">=</span> <span class="nx">parent</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;parent&quot;</span><span class="p">);</span>

            <span class="p">}</span>
            
            <span class="k">return</span> <span class="nx">depth</span><span class="p">;</span>
            
        <span class="p">}</span>
    <span class="p">},</span>

    <span class="cm">/**</span>
<span class="cm">     * @attribute root</span>
<span class="cm">     * @type Widget </span>
<span class="cm">     * @readOnly         </span>
<span class="cm">     *</span>
<span class="cm">     * @description Returns the root Widget in the object hierarchy.  If the</span>
<span class="cm">     * ROOT_TYPE property is set, the search for the root Widget will be </span>
<span class="cm">     * constrained to parent Widgets of the specified type.</span>
<span class="cm">     */</span>
    <span class="nx">root</span><span class="o">:</span> <span class="p">{</span>
        <span class="nx">readOnly</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
        <span class="nx">getter</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

            <span class="kd">var</span> <span class="nx">getParent</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">child</span><span class="p">)</span> <span class="p">{</span>

                <span class="kd">var</span> <span class="nx">parent</span> <span class="o">=</span> <span class="nx">child</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;parent&quot;</span><span class="p">),</span>
                    <span class="nx">FnRootType</span> <span class="o">=</span> <span class="nx">child</span><span class="p">.</span><span class="nx">ROOT_TYPE</span><span class="p">,</span>
                    <span class="nx">criteria</span> <span class="o">=</span> <span class="nx">parent</span><span class="p">;</span>

                <span class="k">if</span> <span class="p">(</span><span class="nx">FnRootType</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">criteria</span> <span class="o">=</span> <span class="p">(</span><span class="nx">parent</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="nx">parent</span> <span class="k">instanceof</span> <span class="nx">FnRootType</span><span class="p">));</span>
                <span class="p">}</span>

                <span class="k">return</span> <span class="p">(</span><span class="nx">criteria</span> <span class="o">?</span> <span class="nx">getParent</span><span class="p">(</span><span class="nx">parent</span><span class="p">)</span> <span class="o">:</span> <span class="nx">child</span><span class="p">);</span>
                
            <span class="p">};</span>

            <span class="k">return</span> <span class="nx">getParent</span><span class="p">(</span><span class="k">this</span><span class="p">);</span>
            
        <span class="p">}</span>
    <span class="p">}</span>

<span class="p">};</span>

<span class="nx">Child</span><span class="p">.</span><span class="nx">prototype</span> <span class="o">=</span> <span class="p">{</span>

    <span class="cm">/**</span>
<span class="cm">     * Constructor reference used to determine the root of a Widget-based </span>
<span class="cm">     * object tree.</span>
<span class="cm">     * &lt;p&gt;</span>
<span class="cm">     * Currently used to control the behavior of the &lt;code&gt;root&lt;/code&gt;  </span>
<span class="cm">     * attribute so that recursing up the object heirarchy can be constrained </span>
<span class="cm">     * to a specific type of Widget.  Widget authors should set this property</span>
<span class="cm">     * to the constructor function for a given Widget implementation.</span>
<span class="cm">     * &lt;/p&gt;</span>
<span class="cm">     *</span>
<span class="cm">     * @property ROOT_TYPE</span>
<span class="cm">     * @type Object</span>
<span class="cm">     */</span>
    <span class="nx">ROOT_TYPE</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>


    <span class="c1">//  Override of Widget&#39;s implementation of _getUIEventNode() to ensure that </span>
    <span class="c1">//  all event listeners are bound to the Widget&#39;s topmost DOM element.</span>
    <span class="c1">//  This ensures that the firing of each type of Widget UI event (click,</span>
    <span class="c1">//  mousedown, etc.) is facilitated by a single, top-level, delegated DOM</span>
    <span class="c1">//  event listener.</span>
    <span class="nx">_getUIEventNode</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
    
        <span class="kd">var</span> <span class="nx">root</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;root&quot;</span><span class="p">),</span>
            <span class="nx">returnVal</span><span class="p">;</span>
        
        <span class="k">if</span> <span class="p">(</span><span class="nx">root</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">returnVal</span> <span class="o">=</span> <span class="nx">root</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;boundingBox&quot;</span><span class="p">);</span>
        <span class="p">}</span>
    
        <span class="k">return</span> <span class="nx">returnVal</span><span class="p">;</span>
        
    <span class="p">},</span>


    <span class="cm">/**</span>
<span class="cm">    * @method next</span>
<span class="cm">    * @description Returns the Widget&#39;s next sibling.</span>
<span class="cm">    * @param {Boolean} circular Boolean indicating if the parent&#39;s first child </span>
<span class="cm">    * should be returned if the child has no next sibling.  </span>
<span class="cm">    * @return {Widget} Widget instance. </span>
<span class="cm">    */</span>
    <span class="nx">next</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">circular</span><span class="p">)</span> <span class="p">{</span>

        <span class="kd">var</span> <span class="nx">parent</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;parent&quot;</span><span class="p">),</span>
            <span class="nx">sibling</span><span class="p">;</span>

        <span class="k">if</span> <span class="p">(</span><span class="nx">parent</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">sibling</span> <span class="o">=</span> <span class="nx">parent</span><span class="p">.</span><span class="nx">item</span><span class="p">((</span><span class="k">this</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;index&quot;</span><span class="p">)</span><span class="o">+</span><span class="mi">1</span><span class="p">));</span>
        <span class="p">}</span>

        <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">sibling</span> <span class="o">&amp;&amp;</span> <span class="nx">circular</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">sibling</span> <span class="o">=</span> <span class="nx">parent</span><span class="p">.</span><span class="nx">item</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span>
        <span class="p">}</span>

        <span class="k">return</span> <span class="nx">sibling</span><span class="p">;</span>

    <span class="p">},</span>


    <span class="cm">/**</span>
<span class="cm">    * @method previous</span>
<span class="cm">    * @description Returns the Widget&#39;s previous sibling.</span>
<span class="cm">    * @param {Boolean} circular Boolean indicating if the parent&#39;s last child </span>
<span class="cm">    * should be returned if the child has no previous sibling.</span>
<span class="cm">    * @return {Widget} Widget instance. </span>
<span class="cm">    */</span>
    <span class="nx">previous</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">circular</span><span class="p">)</span> <span class="p">{</span>

        <span class="kd">var</span> <span class="nx">parent</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;parent&quot;</span><span class="p">),</span>
            <span class="nx">index</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;index&quot;</span><span class="p">),</span>
            <span class="nx">sibling</span><span class="p">;</span>
        
        <span class="k">if</span> <span class="p">(</span><span class="nx">parent</span> <span class="o">&amp;&amp;</span> <span class="nx">index</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">sibling</span> <span class="o">=</span> <span class="nx">parent</span><span class="p">.</span><span class="nx">item</span><span class="p">([(</span><span class="nx">index</span><span class="o">-</span><span class="mi">1</span><span class="p">)]);</span>
        <span class="p">}</span>

        <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">sibling</span> <span class="o">&amp;&amp;</span> <span class="nx">circular</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">sibling</span> <span class="o">=</span> <span class="nx">parent</span><span class="p">.</span><span class="nx">item</span><span class="p">((</span><span class="nx">parent</span><span class="p">.</span><span class="nx">size</span><span class="p">()</span> <span class="o">-</span> <span class="mi">1</span><span class="p">));</span>
        <span class="p">}</span>

        <span class="k">return</span> <span class="nx">sibling</span><span class="p">;</span> 
        
    <span class="p">},</span>


    <span class="c1">//  Override of Y.WidgetParent.remove()</span>
    <span class="c1">//  Sugar implementation allowing a child to remove itself from its parent.</span>
    <span class="nx">remove</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">index</span><span class="p">)</span> <span class="p">{</span>

        <span class="kd">var</span> <span class="nx">parent</span><span class="p">,</span>
            <span class="nx">removed</span><span class="p">;</span>

        <span class="k">if</span> <span class="p">(</span><span class="nx">Lang</span><span class="p">.</span><span class="nx">isNumber</span><span class="p">(</span><span class="nx">index</span><span class="p">))</span> <span class="p">{</span>
            <span class="nx">removed</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">WidgetParent</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">remove</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">arguments</span><span class="p">);</span>
        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>

            <span class="nx">parent</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;parent&quot;</span><span class="p">);</span>

            <span class="k">if</span> <span class="p">(</span><span class="nx">parent</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">removed</span> <span class="o">=</span> <span class="nx">parent</span><span class="p">.</span><span class="nx">remove</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;index&quot;</span><span class="p">));</span>
            <span class="p">}</span>
                        
        <span class="p">}</span>
        
        <span class="k">return</span> <span class="nx">removed</span><span class="p">;</span>
        
    <span class="p">},</span>


    <span class="cm">/**</span>
<span class="cm">    * @method isRoot</span>
<span class="cm">    * @description Determines if the Widget is the root Widget in the </span>
<span class="cm">    * object hierarchy.</span>
<span class="cm">    * @return {Boolean} Boolean indicating if Widget is the root Widget in the </span>
<span class="cm">    * object hierarchy.</span>
<span class="cm">    */</span>
    <span class="nx">isRoot</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
        <span class="k">return</span> <span class="p">(</span><span class="k">this</span> <span class="o">==</span> <span class="k">this</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;root&quot;</span><span class="p">));</span>
    <span class="p">},</span>


    <span class="cm">/**</span>
<span class="cm">    * @method ancestor</span>
<span class="cm">    * @description Returns the Widget instance at the specified depth.</span>
<span class="cm">    * @param {number} depth Number representing the depth of the ancestor.</span>
<span class="cm">    * @return {Widget} Widget instance.</span>
<span class="cm">    */</span>
    <span class="nx">ancestor</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">depth</span><span class="p">)</span> <span class="p">{</span>

        <span class="kd">var</span> <span class="nx">root</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;root&quot;</span><span class="p">),</span>
            <span class="nx">parent</span><span class="p">;</span>

        <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;depth&quot;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="nx">depth</span><span class="p">)</span>  <span class="p">{</span>

            <span class="nx">parent</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;parent&quot;</span><span class="p">);</span>

            <span class="k">while</span> <span class="p">(</span><span class="nx">parent</span> <span class="o">!=</span> <span class="nx">root</span> <span class="o">&amp;&amp;</span> <span class="nx">parent</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;depth&quot;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="nx">depth</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">parent</span> <span class="o">=</span> <span class="nx">parent</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;parent&quot;</span><span class="p">);</span>
            <span class="p">}</span>

        <span class="p">}</span>

        <span class="k">return</span> <span class="nx">parent</span><span class="p">;</span>

    <span class="p">},</span>


    <span class="cm">/**</span>
<span class="cm">     * Updates the UI to reflect the &lt;code&gt;selected&lt;/code&gt; attribute value.</span>
<span class="cm">     *</span>
<span class="cm">     * @method _uiSetChildSelected</span>
<span class="cm">     * @protected</span>
<span class="cm">     * @param {number} selected The selected value to be reflected in the UI.</span>
<span class="cm">     */</span>    
    <span class="nx">_uiSetChildSelected</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">selected</span><span class="p">)</span> <span class="p">{</span>

        <span class="kd">var</span> <span class="nx">box</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;boundingBox&quot;</span><span class="p">),</span>
            <span class="nx">sClassName</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">getClassName</span><span class="p">(</span><span class="s2">&quot;selected&quot;</span><span class="p">);</span>

        <span class="k">if</span> <span class="p">(</span><span class="nx">selected</span> <span class="o">===</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">box</span><span class="p">.</span><span class="nx">removeClass</span><span class="p">(</span><span class="nx">sClassName</span><span class="p">);</span>
        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>
            <span class="nx">box</span><span class="p">.</span><span class="nx">addClass</span><span class="p">(</span><span class="nx">sClassName</span><span class="p">);</span>
        <span class="p">}</span>
        
    <span class="p">},</span>


    <span class="cm">/**</span>
<span class="cm">     * Default attribute change listener for the &lt;code&gt;selected&lt;/code&gt; </span>
<span class="cm">     * attribute, responsible for updating the UI, in response to </span>
<span class="cm">     * attribute changes.</span>
<span class="cm">     *</span>
<span class="cm">     * @method _afterChildSelectedChange</span>
<span class="cm">     * @protected</span>
<span class="cm">     * @param {EventFacade} event The event facade for the attribute change.</span>
<span class="cm">     */</span>    
    <span class="nx">_afterChildSelectedChange</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">event</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_uiSetChildSelected</span><span class="p">(</span><span class="nx">event</span><span class="p">.</span><span class="nx">newVal</span><span class="p">);</span>
    <span class="p">},</span>
    

    <span class="cm">/**</span>
<span class="cm">     * Synchronizes the UI to match the WidgetChild state.</span>
<span class="cm">     * &lt;p&gt;</span>
<span class="cm">     * This method is invoked after bindUI is invoked for the Widget class</span>
<span class="cm">     * using YUI&#39;s aop infrastructure.</span>
<span class="cm">     * &lt;/p&gt;     </span>
<span class="cm">     *</span>
<span class="cm">     * @method _syncUIChild</span>
<span class="cm">     * @protected</span>
<span class="cm">     */</span>    
    <span class="nx">_syncUIChild</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_uiSetChildSelected</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;selected&quot;</span><span class="p">));</span>
    <span class="p">},</span>


    <span class="cm">/**</span>
<span class="cm">     * Binds event listeners responsible for updating the UI state in response </span>
<span class="cm">     * to WidgetChild related state changes.</span>
<span class="cm">     * &lt;p&gt;</span>
<span class="cm">     * This method is invoked after bindUI is invoked for the Widget class</span>
<span class="cm">     * using YUI&#39;s aop infrastructure.</span>
<span class="cm">     * &lt;/p&gt;</span>
<span class="cm">     * @method _bindUIChild</span>
<span class="cm">     * @protected</span>
<span class="cm">     */</span>    
    <span class="nx">_bindUIChild</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span> 
        <span class="k">this</span><span class="p">.</span><span class="nx">after</span><span class="p">(</span><span class="s2">&quot;selectedChange&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_afterChildSelectedChange</span><span class="p">);</span>
    <span class="p">}</span>
    
<span class="p">};</span>

<span class="nx">Y</span><span class="p">.</span><span class="nx">WidgetChild</span> <span class="o">=</span> <span class="nx">Child</span><span class="p">;</span>
</pre></div>

                    </div>
			</div>
		</div>
		<div class="yui-b">
            <div class="nav">

                    <div id="moduleList" class="module">
                        <h4>Modules</h4>
                        <ul class="content">
                                <li class=""><a href="module_align-plugin.html" title="align-plugin">align-plugin</a></li>
                                <li class=""><a href="module_anim.html" title="anim">anim</a></li>
                                <li class=""><a href="module_async-queue.html" title="async-queue">async-queue</a></li>
                                <li class=""><a href="module_attribute.html" title="attribute">attribute</a></li>
                                <li class=""><a href="module_base.html" title="base">base</a></li>
                                <li class=""><a href="module_cache.html" title="cache">cache</a></li>
                                <li class=""><a href="module_classnamemanager.html" title="classnamemanager">classnamemanager</a></li>
                                <li class=""><a href="module_collection.html" title="collection">collection</a></li>
                                <li class=""><a href="module_console.html" title="console">console</a></li>
                                <li class=""><a href="module_console-filters.html" title="console-filters">console-filters</a></li>
                                <li class=""><a href="module_cookie.html" title="cookie">cookie</a></li>
                                <li class=""><a href="module_dataschema.html" title="dataschema">dataschema</a></li>
                                <li class=""><a href="module_datasource.html" title="datasource">datasource</a></li>
                                <li class=""><a href="module_datatype.html" title="datatype">datatype</a></li>
                                <li class=""><a href="module_dd.html" title="dd">dd</a></li>
                                <li class=""><a href="module_dom.html" title="dom">dom</a></li>
                                <li class=""><a href="module_dump.html" title="dump">dump</a></li>
                                <li class=""><a href="module_event.html" title="event">event</a></li>
                                <li class=""><a href="module_event-custom.html" title="event-custom">event-custom</a></li>
                                <li class=""><a href="module_event-simulate.html" title="event-simulate">event-simulate</a></li>
                                <li class=""><a href="module_history.html" title="history">history</a></li>
                                <li class=""><a href="module_imageloader.html" title="imageloader">imageloader</a></li>
                                <li class=""><a href="module_intl.html" title="intl">intl</a></li>
                                <li class=""><a href="module_io.html" title="io">io</a></li>
                                <li class=""><a href="module_json.html" title="json">json</a></li>
                                <li class=""><a href="module_loader.html" title="loader">loader</a></li>
                                <li class=""><a href="module_node.html" title="node">node</a></li>
                                <li class=""><a href="module_node-focusmanager.html" title="node-focusmanager">node-focusmanager</a></li>
                                <li class=""><a href="module_node-menunav.html" title="node-menunav">node-menunav</a></li>
                                <li class=""><a href="module_oop.html" title="oop">oop</a></li>
                                <li class=""><a href="module_overlay.html" title="overlay">overlay</a></li>
                                <li class=""><a href="module_plugin.html" title="plugin">plugin</a></li>
                                <li class=""><a href="module_pluginhost.html" title="pluginhost">pluginhost</a></li>
                                <li class=""><a href="module_profiler.html" title="profiler">profiler</a></li>
                                <li class=""><a href="module_querystring.html" title="querystring">querystring</a></li>
                                <li class=""><a href="module_queue-promote.html" title="queue-promote">queue-promote</a></li>
                                <li class=""><a href="module_shim-plugin.html" title="shim-plugin">shim-plugin</a></li>
                                <li class=""><a href="module_slider.html" title="slider">slider</a></li>
                                <li class=""><a href="module_sortable.html" title="sortable">sortable</a></li>
                                <li class=""><a href="module_stylesheet.html" title="stylesheet">stylesheet</a></li>
                                <li class=""><a href="module_substitute.html" title="substitute">substitute</a></li>
                                <li class=""><a href="module_swf.html" title="swf">swf</a></li>
                                <li class=""><a href="module_swfdetect.html" title="swfdetect">swfdetect</a></li>
                                <li class=""><a href="module_tabview.html" title="tabview">tabview</a></li>
                                <li class=""><a href="module_test.html" title="test">test</a></li>
                                <li class=""><a href="module_widget.html" title="widget">widget</a></li>
                                <li class=""><a href="module_widget-anim.html" title="widget-anim">widget-anim</a></li>
                                <li class="selected"><a href="module_widget-child.html" title="widget-child">widget-child</a></li>
                                <li class=""><a href="module_widget-locale.html" title="widget-locale">widget-locale</a></li>
                                <li class=""><a href="module_widget-parent.html" title="widget-parent">widget-parent</a></li>
                                <li class=""><a href="module_widget-position.html" title="widget-position">widget-position</a></li>
                                <li class=""><a href="module_widget-position-align.html" title="widget-position-align">widget-position-align</a></li>
                                <li class=""><a href="module_widget-position-constrain.html" title="widget-position-constrain">widget-position-constrain</a></li>
                                <li class=""><a href="module_widget-stack.html" title="widget-stack">widget-stack</a></li>
                                <li class=""><a href="module_widget-stdmod.html" title="widget-stdmod">widget-stdmod</a></li>
                                <li class=""><a href="module_yui.html" title="yui">yui</a></li>
                        </ul>
                    </div>

                    <div id="classList" class="module">
                        <h4>Classes</h4>
                        <ul class="content">
                                <li class=""><a href="WidgetChild.html" title="WidgetChild">WidgetChild</a></li>
                        </ul>
                    </div>

                    <div id="fileList" class="module">
                        <h4>Files</h4>
                        <ul class="content">        
                                <li class="selected"><a href="Widget-Child.js.html" title="Widget-Child.js">Widget-Child.js</a></li>
                        </ul>
                    </div>





            </div>
		</div>
	</div>
	<div id="ft">
        <hr />
        Copyright &copy; 2010 Yahoo! Inc. All rights reserved.
	</div>
</div>
<script type="text/javascript">

    var ALL_YUI_PROPS = [{"access": "protected", "host": "WidgetChild", "name": "_afterChildSelectedChange", "url": "WidgetChild.html#method__afterChildSelectedChange", "type": "method"}, {"access": "", "host": "WidgetChild", "name": "ancestor", "url": "WidgetChild.html#method_ancestor", "type": "method"}, {"access": "protected", "host": "WidgetChild", "name": "_bindUIChild", "url": "WidgetChild.html#method__bindUIChild", "type": "method"}, {"access": "", "host": "WidgetChild", "name": "depth", "url": "WidgetChild.html#config_depth", "type": "config"}, {"access": "", "host": "WidgetChild", "name": "depthChange", "url": "WidgetChild.html#event_depthChange", "type": "event"}, {"access": "", "host": "WidgetChild", "name": "index", "url": "WidgetChild.html#config_index", "type": "config"}, {"access": "", "host": "WidgetChild", "name": "indexChange", "url": "WidgetChild.html#event_indexChange", "type": "event"}, {"access": "", "host": "WidgetChild", "name": "isRoot", "url": "WidgetChild.html#method_isRoot", "type": "method"}, {"access": "", "host": "WidgetChild", "name": "next", "url": "WidgetChild.html#method_next", "type": "method"}, {"access": "", "host": "WidgetChild", "name": "parent", "url": "WidgetChild.html#config_parent", "type": "config"}, {"access": "", "host": "WidgetChild", "name": "parentChange", "url": "WidgetChild.html#event_parentChange", "type": "event"}, {"access": "", "host": "WidgetChild", "name": "previous", "url": "WidgetChild.html#method_previous", "type": "method"}, {"access": "", "host": "WidgetChild", "name": "root", "url": "WidgetChild.html#config_root", "type": "config"}, {"access": "", "host": "WidgetChild", "name": "rootChange", "url": "WidgetChild.html#event_rootChange", "type": "event"}, {"access": "", "host": "WidgetChild", "name": "ROOT_TYPE", "url": "WidgetChild.html#property_ROOT_TYPE", "type": "property"}, {"access": "", "host": "WidgetChild", "name": "selected", "url": "WidgetChild.html#config_selected", "type": "config"}, {"access": "", "host": "WidgetChild", "name": "selectedChange", "url": "WidgetChild.html#event_selectedChange", "type": "event"}, {"access": "protected", "host": "WidgetChild", "name": "_syncUIChild", "url": "WidgetChild.html#method__syncUIChild", "type": "method"}, {"access": "protected", "host": "WidgetChild", "name": "_uiSetChildSelected", "url": "WidgetChild.html#method__uiSetChildSelected", "type": "method"}];
</script>
</body>
</html>
